﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Data.SqlClient;

/// <summary>
/// 返回結果
/// </summary>
[DataContract]
class RouteInfo_Result {
    /// <summary>
    /// 線路名稱
    /// </summary>
    [DataMember(Order = 1)]
    public string name { get; set; }
}
public partial class Service_RouteInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["rtid"]))
        {
            using (MyDb.Db db = new MyDb.Db())
            {
                RouteInfo_Result item = null;
                using (SqlDataReader rs = db.getList(string.Format("select distinct(nameZh) from route where id={0}", Request.QueryString["rtid"])))
                {
                    if (rs.Read())
                    {
                        item = new RouteInfo_Result();
                        item.name = rs["nameZh"].ToString();
                        Response.Write(MyDb.JSON.stringify(item));
                    }
                    rs.Close();
                }
            }
        }
        Response.End();
    }
}
